//
//  BaseViewController.m
//  A_DLS151129
//
//  Created by 151129-49宋强 on 16/1/15.
//  Copyright © 2016年 www.lanou3g.com蓝鸥. All rights reserved.
//

#import "BaseViewController.h"
#import "MyDrawerViewController.h"
#import "UIViewController+MMDrawerController.h"
#import "MMDrawerBarButtonItem.h"

@interface BaseViewController ()
@property (nonatomic, retain) UIBarButtonItem *fenleiItem;
@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.fenleiItem =  [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"chouti.png"] style:UIBarButtonItemStylePlain target:self action:@selector(leftDrawerAction:)] autorelease];
    [self.fenleiItem setTintColor:[UIColor blackColor]];
    // 添加左按钮
    self.navigationItem.leftBarButtonItems = @[ _fenleiItem];
    //添加搜索按钮
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(searchAction:)];
    self.navigationItem.rightBarButtonItem.tintColor = [UIColor blackColor];
    [_fenleiItem release];
    [self.navigationItem.rightBarButtonItem release];
}
#pragma mark - 跳转搜索界面
- (void)searchAction:(UIBarButtonItem *)rightBtn
{
    SearchViewController *searchVC = [[SearchViewController alloc] init];
    [self.navigationController pushViewController:searchVC animated:YES];
    [searchVC release];
}
- (void)leftDrawerAction:(id)btn
{
    [self.mm_drawerController toggleDrawerSide:(MMDrawerSideLeft) animated:YES completion:^(BOOL finished) {
        
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
